package com.mhkj.base.region.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.mhkj.base.region.service.NationService;

/**
 * @Author: Administrator
 * @Desc:
 * @Date: 15:57 2018/6/19
 */
@RestController
public class NationController {

    @Autowired
    private NationService nationService;

    /**
     * 根据ID查询当前城市详细信息
     *
     * @param id 城市ID
     * @return 当前区域实体
     */
    @RequestMapping("/nation/getById")
    public Object getById(Long id) {

        return nationService.findById(id);
    }

    /**
     * 根据当前pid查询当前省级区域下面的所有市级区域
     *
     * @param pid 父级区域ID
     * @return List<TSysNation>
     */
    @RequestMapping("/nation/getListByPid")
    public Object getListByPid(Long pid) {

        return nationService.findByPid(pid);
    }


    /**
     * 查找当前所有省级区域
     *
     * @return
     */
    @RequestMapping("/nation/getAllProvince")
    public Object getAllProvince() {
        return nationService.findByPid(1L);
    }

    /**
     * 获取当前所有有项目省级区域集合
     *
     * @return
     */
    @RequestMapping("/province/listByItem")
    public Object getAllItemProvince() {
        return nationService.findAllItemProvince();
    }

    /**
     * 获取当前Pid省级区域下的所有市级区域集合
     *
     * @param pid 父级ID
     * @return
     */
    @RequestMapping("/city/listByItem")
    public Object getAllItemNation(Long pid) {
        return nationService.findAllItemNation(pid);

    }
}
